package mirrormonkey.state.member.accessor;

import java.lang.reflect.Method;

import mirrormonkey.framework.entity.SyncEntity;

public class GetterReadAccessor implements ValueReadAccessor {

	public final Method getter;

	public GetterReadAccessor(Method getter) {
		this.getter = getter;
	}

	@Override
	public Object readValue(SyncEntity entity) {
		try {
			return getter.invoke(entity);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

}
